<?php
namespace common\components\extenders;

use yii\base\Component;
use yii\console\Exception;
use yii\helpers\Json;

class SwooleClientnewManage extends Component
{

    public function send($data)
    {
        $str = "";
        if (!empty($data)) {
            foreach ($data as $key => $val) {
                $str .= " --" . $key . ' ' . $val;
            }
        }
        /**$tmpdir = dirname(dirname(dirname(__DIR__))) . "/console/runtime/logs/swoole.log";//需要有写入权限
        if (($fp = @fopen($tmpdir, 'a')) === false) {
            return;
        } else {*/
            $filedir = __DIR__ . "/SwooleClientnew.php";
            shell_exec("nohup php $filedir" . $str . " >/dev/null 2>&1 &");//异步挂起执行，参考文档：https://www.cnblogs.com/tinywan/p/6443615.html
            //等学会怎样定时清除文件内容就把>改成>>后缀添加比较好
      /*  }*/
    }

}